import { Command } from '@/commands/command.ts'
import { new_command } from '@/models/command.ts'

export class BaseCommand extends Command {
    public static new(args: string): Command {
        const command = new_command()
        command.args = args
        command.name = 'base'
        command.component = 'AllowCopyCommandComponent'

        return new BaseCommand(command, false)
    }

    usage(): string {
        return 'base [-d] [--no-padding] [--32] [--rfc4648 [--padding]] 字符串'
    }

    description(): string {
        return `<div>使用BASE32或BASE64编码或解码数据</div>
        <br/>
        <div>选项说明:</div>
        <br/>
        <div class="option-row"><span class="option-option">-d --decode</span><span>解码模式，传入此参数时，字符串应为base32或base64编码字符串</span></div>
        <div class="option-row"><span class="option-option">--no-padding</span><span>指定编码或解码时为无填充模式</span></div>
        <div class="option-row"><span class="option-option">--32</span><span>指定编码或解码使用base32格式</span></div>
        <div class="option-row"><span class="option-option">--rfc4648</span><span>指定base32编码使用的字符集</span></div>
        <div class="option-row"><span class="option-option">--padding</span><span>指定--rfc4648选项时有效，可设置rfc4648字符集的填充选项</span></div>`
    }
}
